function formatPrice(price){
	return price/100;
}

function freshBanner(data){
	let urlPre="/productdetail?productId=";
	let imgUrlPre = "http://image.pq.com/";
	for (var i = 0; i < data.length; i++) {
		$("#wrapper .swipe #slider li a:eq("+i+")").attr("href",urlPre+data[i]["id"]);
		$("#wrapper .swipe #slider li a img:eq("+i+")").attr("src",imgUrlPre+data[i]["imgUrl"]);
		}
}
function freshHotProduct(data){
	let urlPre="/productdetail?productId=";
	let imgUrlPre = "http://image.pq.com/";
	let length = data.length>3?3:data.length;
	for (var i = 0; i < length; i++) {
		$(".hot_txt li a:eq("+i+")").attr("href",urlPre+data[i]["productId"]);
		$(".hot_txt li a div img:eq("+i+")").attr("src",imgUrlPre+data[i]["imgUrl"]);
		$(".hot_txt li a .cpname01:eq("+i+")").html(data[i]["title"]);
		$(".hot_txt li a .jg01:eq("+i+")").html("&yen;"+formatPrice(data[i]["price"]));
	}
}
//新品
function freshNewProduct(data){
	let urlPre="/productdetail?productId=";
	let imgUrlPre = "http://image.pq.com/";
	let length = data.length>4?4:data.length;
	for (var i = 0; i < length; i++) {
		$(".newcp li a:eq("+i+")").attr("href",urlPre+data[i]["productId"]);
		$(".newcp li a div img:eq("+i+")").attr("src",imgUrlPre+data[i]["imgUrl"]);
		$(".newcp li a .cpname02:eq("+i+")").html(data[i]["title"]);
		$(".newcp li a .jg02:eq("+i+")").html("&yen;"+formatPrice(data[i]["price"]));
	}
}